package com.xx.happychatboot.middleware.jwt.controller;

import com.xx.happychatboot.middleware.jwt.service.JwtService;
import com.xx.happychatboot.middleware.springsecurity.domain.vo.response.AuthResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * JWT Controller
 */
@Controller
public class JwtController {

    @Autowired
    private JwtService jwtService;

    @PostMapping("/refresh-token/{refreshToken}")
    @ResponseBody
    public AuthResponse refreshToken (@PathVariable("refreshToken") String refreshToken) {
        return jwtService.refreshToken(refreshToken);
    }
}
